﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace yule.Common.Cache
{
    public abstract class BaseCacheStrategy : ICacheStrategy
    {

        protected string GetTypeKey<T>() where T : class
        {
            Type type = typeof(T);
            return string.Format("Type:{0}|Key:", type.FullName);
        }

        protected string GetCacheKey<T>(string key) where T : class
        {
            string stkey = GetTypeKey<T>();
            string tkey = string.Format("{0}{1}", stkey, key);
            return tkey;
        }


        #region ICacheStrategy 成员

        public abstract bool Set<T>(string key, T obj) where T : class;

        public abstract T Get<T>(string key) where T : class;

        public abstract IList<T> Get<T>() where T : class;

        public abstract bool Remove<T>(string key) where T : class;

        public abstract bool Remove<T>() where T : class;

        #endregion
    }
}
